<?php

namespace plugin\ycMassage\process;

use plugin\ycMassage\app\model\MassageUserAgent;
use plugin\ycMassage\utils\enum\State;

class AgentExpire
{
    public function run()
    {
        try {
            $OrderList = MassageUserAgent::where(['state' => State::YES['value']])
                ->whereTime('expire_time', '<', date('Y-m-d H:i:s'))->select();
            foreach ($OrderList as $item) {
                $item->state = State::NO['value'];
                $item->save();
            }
        } catch (\Throwable $th) {
            p([$th->getMessage(), $th->getLine(), $th->getFile()], 'MassageAgentExpire');
        }
    }
}
